import request from '../utils/request'
// 获取home标签栏的数据
export const getUserChannelAPI = () => {
  return request.get('/v1_0/user/channels')
}

// 获取home文章列表的数据  get请求的参数需要以一个params对象形式传入
export const getArtListAPI = (id) => {
  return request.get('/v1_1/articles', { params: { channel_id: id, timestamp: Date.now(), with_top: 1 } })
}

// 将文章设置为不感兴趣的API
export const dislikeArtAPI = (id) => {
  return request.post('/v1_0/article/dislikes', { target: id })
}

// 举报文章API
export const reportArtListAPI = (id, type) => {
  return request.post('/v1_0/article/reports', { target: id, type: type })
}

// 获取所有文章的API
export const getAllChannelAPI = () => {
  return request.get('/v1_0/channels')
}

// 更新用户的频道列表   channels的格式为一个数组 里面的值为{id:12,seq:1}
export const updateUserChannelAPI = (channels) => {
  return request.put('/v1_0/user/channels', { channels })
}
